﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {

    public class DailyBonus {

        private var m_day:int = 0;
        private var m_recoveryCash:int = 0;
        private var m_isSurprise:Boolean = false;
        private var m_coin:int = 0;
        private var m_energy:int = 0;
        private var m_food:int = 0;
        private var m_goods:int = 0;
        private var m_item:String = "";
        private var m_xp:int = 0;
        private var m_items:Array;

        public function DailyBonus(_arg1:XML){
            this.m_items = [];
            super();
            this.parseFromXml(_arg1);
        }
        public function get day():int{
            return (this.m_day);
        }
        public function get recoveryCash():int{
            return (this.m_recoveryCash);
        }
        public function get isSurprise():Boolean{
            return (this.m_isSurprise);
        }
        public function get coin():int{
            return (this.m_coin);
        }
        public function get energy():int{
            return (this.m_energy);
        }
        public function get food():int{
            return (this.m_food);
        }
        public function get goods():int{
            return (this.m_goods);
        }
        public function get item():String{
            return (this.m_item);
        }
        public function get xp():int{
            return (this.m_xp);
        }
        public function get items():Array{
            return (this.m_items);
        }
        private function parseFromXml(_arg1:XML):void{
            var _local2:XML;
            this.m_day = int(Number(_arg1.@number));
            this.m_recoveryCash = int(Number(_arg1.@recoveryCash));
            this.m_isSurprise = Boolean((_arg1.@surprise == "true"));
            if (this.m_isSurprise){
                this.m_coin = (_arg1.randomchance.hasOwnProperty("coin")) ? int(Number(_arg1.randomchance.coin.@amount)) : 0;
                this.m_energy = (_arg1.randomchance.hasOwnProperty("energy")) ? int(Number(_arg1.randomchance.energy.@amount)) : 0;
                this.m_food = (_arg1.randomchance.hasOwnProperty("food")) ? int(Number(_arg1.randomchance.food.@amount)) : 0;
                this.m_goods = (_arg1.randomchance.hasOwnProperty("goods")) ? int(Number(_arg1.randomchance.goods.@amount)) : 0;
                if (_arg1.randomchance.hasOwnProperty("item")){
                    for each (_local2 in _arg1.randomchance.item) {
                        this.m_items.push(String(_local2.@name));
                    };
                };
                this.m_xp = (_arg1.randomchance.hasOwnProperty("xp")) ? int(Number(_arg1.randomchance.xp.@amount)) : 0;
                return;
            };
            this.m_coin = (_arg1.hasOwnProperty("coin")) ? int(Number(_arg1.coin[0].@amount)) : 0;
            this.m_energy = (_arg1.hasOwnProperty("energy")) ? int(Number(_arg1.energy[0].@amount)) : 0;
            this.m_food = (_arg1.hasOwnProperty("food")) ? int(Number(_arg1.food[0].@amount)) : 0;
            this.m_goods = (_arg1.hasOwnProperty("goods")) ? int(Number(_arg1.goods[0].@amount)) : 0;
            this.m_item = (_arg1.hasOwnProperty("item")) ? String(_arg1.item[0].@name) : "";
            this.m_xp = (_arg1.hasOwnProperty("xp")) ? int(Number(_arg1.xp[0].@amount)) : 0;
        }

    }
}//package Classes 
